﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

using AimGameEngine.EditorObject;

using AimGameLibrary;

namespace AimGameEngine.NodeEditorObject
{
    public class NodeButtonController : NodeController
    {
        public Microsoft.Xna.Framework.Input.Buttons mybuttons;

        public NodeButtonController(SpriteBatch inputspritebatch, Camera inputcamera, NodeData inputData
            , List<IDraw> MyListDraw, List<IUpdateMainTime> MyListUpdateTime, Dictionary<String, NodeObject> MyListObject, Dictionary<String, NodeObject> MyListType)
            : base(inputspritebatch, inputcamera, inputData, MyListDraw,MyListUpdateTime, MyListObject, MyListType)
	    {
            InputMode = NodeInputMode.Pressed_Release;
            mybuttons = Microsoft.Xna.Framework.Input.Buttons.Back;
	    }


        public override void ShowProprety(ArrayList Temp, CallBack input)
        {
            base.ShowProprety(Temp, input);
            PropretyButtonController propretybutooncontroller = new PropretyButtonController(this);
            //propretybutooncontroller.Deactivate += new EventHandler(input.Deactivate);
            propretybutooncontroller.okButton.Click += new EventHandler(input.Deactivate);
            propretybutooncontroller.ShowDialog();
            
        }

        public override void SaveData(System.Collections.ArrayList Thislist, SaveMode inputsavemode)
        {
            base.SaveData(Thislist, inputsavemode);

            Thislist.Add(mybuttons);
            Thislist.Add(InputMode);

            SaveDataDictionary(Thislist);
        }

        public override void LoadData(Identification getdata, int IndexData)
        {
            base.LoadData(getdata, IndexData);

            if (getdata.Items.GetValue(IndexData + 1).GetType() == typeof(Microsoft.Xna.Framework.Input.Buttons))
                mybuttons = (Microsoft.Xna.Framework.Input.Buttons)getdata.Items.GetValue(IndexData + 1);

            if (getdata.Items.GetValue(IndexData + 2).GetType() == typeof(NodeInputMode))
                InputMode = (NodeInputMode)getdata.Items.GetValue(IndexData + 2);

            SetupProprety();
        }
    }
}
